from django.urls import path
from . import views
from django.contrib.auth import views as auth_views

urlpatterns = [
    # 基础用户认证
    path('', views.home, name='home'),
    path('login/', auth_views.LoginView.as_view(template_name='users/login.html'), name='login'),
    path('logout/', auth_views.LogoutView.as_view(next_page='home'), name='logout'),
    path('register/', views.register, name='register'),
    
    # 个人中心
    path('profile/', views.profile, name='profile'),
    path('profile/edit/', views.edit_profile, name='edit_profile'),
    path('profile/change-password/', views.change_password, name='change_password'),
    
    # 收货地址管理
    path('address/', views.address_list, name='address_list'),
    path('address/add/', views.add_address, name='add_address'),
    path('address/<int:address_id>/edit/', views.edit_address, name='edit_address'),
    path('address/<int:address_id>/delete/', views.delete_address, name='delete_address'),
    path('address/<int:address_id>/default/', views.set_default_address, name='set_default_address'),
    
    # 收藏商家
    path('favorites/', views.favorite_merchants, name='favorite_merchants'),
    path('favorites/add/<int:merchant_id>/', views.add_to_favorites, name='add_to_favorites'),
    path('favorites/remove/<int:merchant_id>/', views.remove_from_favorites, name='remove_from_favorites'),
]
